import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:largefriends/res/lf_color.dart';
import 'package:largefriends/utils/lf_date_time_extension.dart';

import '../../../entity/entities/chat_new_message_entity.dart';
import '../../../res/lf_fonts.dart';
import '../../../res/lf_text_style.dart';

class LfMessageTime extends StatelessWidget {
  final ChatNewMessageEntity data;

  const LfMessageTime({Key? key, required this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    ///消息发送时间
    return Visibility(
      visible: data.shouldShowTime,
      child: Padding(
        padding: EdgeInsets.symmetric(vertical: 9.h),
        child: Text(
          DateTime.fromMillisecondsSinceEpoch(data.created * 1000)
              .getChatTimeString(),
          style: lfTextStyle(
              sp: 12.sp, fontFamily: fontRegular, color: colorFEFEFE),
        ),
      ),
    );
  }
}
